/*
 * Copyright (C) Francisco Morero Peyrona. All rights reserved.
 *
 * This software is published under the terms of Open Source
 * License version 1.1, a copy of which has been included with this
 * distribution in the License.txt file.
 */

package jdbcmanager.dbtools.datatypes;

/**
 * Entities that exists in DataBase: tables, indices, relations, ...
 * <p>
 * This class is parent class for other classes only in this package.
 * 
 * @author Francisco Morero Peyrona
 */
abstract class DbEntityDefinition implements Cloneable
{
   /** An instance of <code>DbEntityDescriptor</code> class */
   protected DbEntityDescriptor ded = null;

   /**
    * Class constructor
    * @param td
    */
   public DbEntityDefinition( DbEntityDescriptor ded )
   {
      if( ded == null )
         ded = new DbEntityDescriptor();
      
      this.ded = ded;
   }
   
   public String getCatalog()       { return this.ded.getCatalog();       }
   public String getSchema()        { return this.ded.getSchema();        }
   public String getName()          { return this.ded.getName();          }
   public String getType()          { return this.ded.getType();          }
   public String getQualifiedName() { return this.ded.getQualifiedName(); }
   
   public Object clone()
   {
      try
      {
         DbEntityDefinition o = (DbEntityDefinition) super.clone();
                            o.ded = (DbEntityDescriptor) this.ded.clone();
         return o;
      }
      catch( CloneNotSupportedException exc )
      {
         throw new InternalError();    // This should not happen
      }
   }
}